<?php defined('SYSPATH') or die('No direct script access.');
/**
* Message Strings
* English Version
*/
class Language_Message {
	
	private $ss;
	
	static function &factory() {
	   $o = new Language_Message();
	  return $o;	
	}
	
	public function __construct()
	{
		$this->ss					= Session::instance();
	}
	
	private function language_strings($show_message)
	{
		$language = $this->ss->get('langid');
		
		$MSG_STR = array();
		
		switch($language)
		{
			case 'ID':
					// Language - Indonesian
					// EDITABLE REGION <-- START -->
					$MSG_STR['wrong_captcha']['text']         = 'Kode Captcha Salah.';
					$MSG_STR['login_success']['text']         = 'Anda Telah logged In.';
					$MSG_STR['login_fails']['text']           = 'Kombinasi Username/password salah.	Pastikan tombol Capslock telah mati dan silahkan mencoba kembali.';
					$MSG_STR['logout_success']['text']        = 'Logged Out Sukses';
					$MSG_STR['not_login']['text']             = 'Harap Login terlebih dahulu';
					$MSG_STR['not_allowed']['text']           = 'Anda tidak memiliki wewenang untuk membuka halaman ini !';
					$MSG_STR['success']['text']               = ' data tersimpan.';
					$MSG_STR['fails']['text']                 = ' data tidak tersimpan.';
					$MSG_STR['c_success']['text']             = 'Data baru telah disimpan.';
					$MSG_STR['c_fails']['text']               = 'Data tidak dapat disimpan.';
					$MSG_STR['u_success']['text']             = 'Data telah berhasil di-Update.';
					$MSG_STR['u_fails']['text']               = 'Data tidak dapat di update.';
					$MSG_STR['d_success']['text']             = 'Sukses menghapus Data.';
					$MSG_STR['d_fails']['text']               = 'Gagal menghapus Data';
					$MSG_STR['album_exist']['text']           = 'Gagal Menyimpan, Nama Album sudah Ada.';
					$MSG_STR['upload_success']['text']        = 'Upload Success !.';
					$MSG_STR['upload_criteria_fails']['text'] = 'File tidak memenuhi kriteria !.';
					$MSG_STR['choose_pages']['text']          = 'Pilih Subject Atau Page untuk Edit.';
					$MSG_STR['empty_stock']['text']           = 'Stock Product Tidak Cukup.';
					$MSG_STR['restore_fail']['text']          = 'Restore Data Error.';
					$MSG_STR['restore_success']['text']       = 'Restore Data Success.';
					$MSG_STR['no_invoice']['text']       			= 'No Invoice tidak ada.';
					// EDITABLE REGION <-- END -->
					break;
			
			default:
					// Default Language - English
					// EDITABLE REGION <-- START -->
					$MSG_STR['wrong_captcha']['text']					= 'Wrong Captcha Code.';
					$MSG_STR['login_success']['text']					= 'You are logged In.';
					$MSG_STR['login_fails']['text']						= 'Username/password combination incorrect.	Please make sure your caps lock key is off and try again.';
					$MSG_STR['logout_success']['text']				= 'Successfully Logged Out';
					$MSG_STR['not_login']['text']							= 'Please Login First';
					$MSG_STR['not_allowed']['text']						= 'You do not have the authority to go to this page !';
					$MSG_STR['success']['text']								= ' data successfully saved.';
					$MSG_STR['fails']['text']									= ' data could not be saved.';
					$MSG_STR['c_success']['text']							= 'New data successfully saved';
					$MSG_STR['c_fails']['text']								= 'The data could not be save.';
					$MSG_STR['u_success']['text']							= 'The data was successfully updated.';
					$MSG_STR['u_fails']['text']								= 'The data could not be updated.';
					$MSG_STR['d_success']['text']							= 'The data was successfully deleted.';
					$MSG_STR['d_fails']['text']								= 'Data deletion failed.';
					$MSG_STR['album_exist']['text']						= 'Save Failed, Album Name Exist.';
					$MSG_STR['upload_success']['text']				= 'Upload Success !.';
					$MSG_STR['upload_criteria_fails']['text']	= 'Upload File Dont Match The Criteria !.';
					$MSG_STR['choose_pages']['text']					= 'Please Choose Subject or Page to Edit.';
					$MSG_STR['empty_stock']['text']						= 'Stock Product Tidak Cukup.';
					$MSG_STR['restore_fail']['text']          = 'Restore Data Error.';
					$MSG_STR['restore_success']['text']       = 'Restore Data Success.';
					$MSG_STR['no_invoice']['text']       			= 'No Invoice tidak ada.';
					// EDITABLE REGION <-- END -->
					break;
		}
		
		// Change Alert Box
		// EDITABLE REGION <-- START -->
				$MSG_STR['wrong_captcha']['code']         = 'alert-error';
				$MSG_STR['login_success']['code']         = 'alert-success';
				$MSG_STR['login_fails']['code']           = 'alert-error';
				$MSG_STR['logout_success']['code']        = 'alert-success';
				$MSG_STR['not_login']['code']             = 'alert-error';
				$MSG_STR['not_allowed']['code']           = 'alert-error';
				$MSG_STR['success']['code']               = 'alert-success';
				$MSG_STR['fails']['code']                 = 'alert-error';
				$MSG_STR['c_success']['code']             = 'alert-success';
				$MSG_STR['c_fails']['code']               = 'alert-error';
				$MSG_STR['u_success']['code']             = 'alert-success';
				$MSG_STR['u_fails']['code']               = 'alert-error';
				$MSG_STR['d_success']['code']             = 'alert-success';
				$MSG_STR['d_fails']['code']               = 'alert-error';
				$MSG_STR['album_exist']['code']           = 'alert-error';
				$MSG_STR['upload_success']['code']        = 'alert-success';
				$MSG_STR['upload_criteria_fails']['code'] = 'alert-error';
				$MSG_STR['choose_pages']['code']          = 'alert-info';
				$MSG_STR['empty_stock']['code']           = 'alert-error';
				$MSG_STR['restore_fail']['code']          = 'alert-error';
				$MSG_STR['no_invoice']['code']          	= 'alert-error';
				$MSG_STR['restore_success']['code']       = 'alert-success';
		// EDITABLE REGION <-- END -->
		
		return $MSG_STR[$show_message];
	}
	
	public function store_message($show_message)
	{
		$message_val = $this->language_strings($show_message);
		$this->ss->set('message_text',$message_val['text']);
		$this->ss->set('message_code',$message_val['code']);
	}
	
	public function store_many_message($value_success,$value_fails)
	{
		$message_success = $this->language_strings('success');
		$message_fails	 = $this->language_strings('fails');
		
		$message_strings	= '<strong>'.$value_success.'</strong>'.$message_success['text'].' and <strong>'.$value_fails.'</strong>'.$message_fails['text'];
		
		$this->ss->set('message_text',$message_strings);
		$this->ss->set('message_code','alert-info');
	}
}